<script>
function updateDepartment(){
    $('#content_area').slideUp();
    var did = $("input[name='did']").val();
    var dn = $("input[name='dn']").val();
    
    var obj = sendRequest("departmentFunctions.php?cmd=4&dn="+dn+"&did="+did);  

    if(obj.result == 1){
            showStatus(obj);
            getAllDepartments();

    }else{
           showStatus(obj); 
    }
}

</script>

        <?php
            $did = intval($_REQUEST['id']);
            include_once 'department.php';
            
                  
            $obj = new departments();
            
            if(!$obj->get_department($did)){
                echo 'could not find';
            }
                
            $row = $obj->fetch();
            $dname = $row['department_name'];
        ?>
        <form action="" method="post" id="add-form">
           
                
                <legend> Department Information </legend>
                <table class="add">
                    <tr id="add-icon">
                        <td colspan="2">
                        <span class="flaticon-hospital14"></span>
                        </td>
                    </tr>
                <input type="hidden" name="did" value="<?php 
                echo $did ?>" >
                <tr>
                    <td>
                Department name: </td>
                    <td><input type="text" size="40"name="dn" value="<?php echo $dname ?>">
                    </td>
                </tr>
                
                <tr class="add-button">
                    <td colspan="2">
                        <input type="button" value="update" onclick="updateDepartment()">
                    </td>
                </tr>
                </table>
          
        </form>  
